<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表</title>
    <script type="text/javascript" src="https://vuejs.org/js/vue.js"></script>
    <style>
        .v-leave-active{
            transition: all 1s;
            opacity: 0;
            transform: translateY(-30px);
        }
    </style>
</head>
<body>

<div id="app">
    <h3>大纲</h3>
    <transition-group tag="ul">
        <li v-for="topic in syllabus" :key="topic">
            <button @click="completed(topic)">Done</button>{{topic}}
        </li>
    </transition-group>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            syllabus:[
                'HTML',
                'CSS',
                'Scratch',
                'Javascript',
                'Python'
            ]
        },
        methods:{
            completed(topic){
                let index = this.syllabus.indexOf(topic)
                this.syllabus.splice(index, 1); //去掉一个
            }
        }
    })
</script>

</body>
</html>